package com.xx.frame;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class Util {

    public static List<Component> getAllComponents(Container container) {

        List<Component> components = new ArrayList<>();
        Component[] children = container.getComponents();
        for (Component child : children) {
            components.add(child);
            if (child instanceof Container) {
                components.addAll(getAllComponents((Container) child));
            }
        }
        return components;
    }
}
